<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:ui="http://java.sun.com/jsf/facelets" 
      xmlns:h="http://java.sun.com/jsf/html" 
      xmlns:t="http://myfaces.apache.org/tomahawk"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:body>
    	<ui:composition template="./templates/framework.xhtml">
			<ui:define name="content">
				<ui:fragment rendered="#{empty selectKeeBookBean.boxes}">
					<ui:include src="./templates/header.xhtml">
						<ui:param name="text" value="#{i18n['createBook.headFirst']}" />
					</ui:include>
				</ui:fragment>
				<ui:fragment rendered="#{not empty selectKeeBookBean.boxes}">
					<ui:include src="./templates/header.xhtml">
						<ui:param name="text" value="#{i18n['createBook.headMore']}" />
					</ui:include>
				</ui:fragment>
				<h:form onsubmit="updateCreateKeeBookForm()" id="createKeeBookForm" styleClass="primary">
					<h:inputHidden id="salt" value="#{createKeeBookBean.salt}" />
					<div>
						<h:outputLabel for="keeBookName" value="#{i18n['createBook.title']}" />
						<h:inputText id="keeBookName" autocomplete="off" required="true" requiredMessage="#{i18n['generic.valueRequired']}" value="#{createKeeBookBean.keeBookName}" />
						<span class="error"><h:message for="keeBookName" /></span>
					</div>
					<div>
						<h:outputLabel for="masterPassword" value="#{i18n['generic.password']}" />
						<h:inputSecret id="masterPassword" autocomplete="off" required="true" requiredMessage="#{i18n['generic.valueRequired']}" value="#{createKeeBookBean.masterPassword}" styleClass="switchVisibility" />
						<span class="error"><h:message for="masterPassword" /></span>
					</div>
					<div>
						<h:selectBooleanCheckbox id="passwordChecked" value="#{createKeeBookBean.passwordChecked}" validator="#{genericValidationBean.validatePasswordChecked}" />
						<h:outputLabel for="passwordChecked" styleClass="checkboxLabel"><h:outputText value="#{i18n['generic.passwordChecked']}" /></h:outputLabel>
						<span class="error"><h:message for="passwordChecked" /></span>
					</div>
					<div class="warn">
						<h:outputText value="#{i18n['createBook.hint']}" />
					</div>
					<div class="buttons">
						<h:commandButton type="submit" value="#{i18n['generic.create']}" action="#{createKeeBookBean.create}" />
						<ui:fragment rendered="#{not empty selectKeeBookBean.boxes}">
							<input type="button" value="#{i18n['generic.cancel']}" onclick="location.href='selectkeebook.xhtml'" />
						</ui:fragment>
					</div>
				</h:form>
			</ui:define>
		</ui:composition>
    </h:body>
</html>